var vm = new Vue({
    el: "#box",
    data: {
        text: "",
        list: []
    },
    methods: {
        pushElement() {
            var obj = { id: this.list.length+1, text: this.text, status: false }
            if (this.text != "") {
                this.list.push(obj);
                this.text = "";
            }
        },
        changeStatus(item){
            item.status = !item.status;
            console.log(item.status);

        },
        del(index){
            this.list.splice(index,1);
            //  Vue.set(this.list,index,index)
            console.log(index);

        }
    },
    // 计算属性computed
    computed:{
        recrod(){
            var sum = 0;
            // 循环list找到元素status属性为false时sum自增
            this.list.forEach((item) => {
                 if(item.status == false){
                    sum++;
                 }
                
            });
            return sum;
        }
    }

})